package com.lrs.java.j2se_base.oo_thinking;

import com.lrs.java.j2se_base.oo_thinking.protectedTest.T;

public class TestAccess {
	
	public static void main(String[] args) {
		TT tt = new TT();
		tt.getJ();
		tt.getK();
		tt.getM();
		
		TTT ttt = new TTT();
		ttt.getJ();
		ttt.getK();
		ttt.getM();
	}
	
}

class TT {
	private T t;
	
	public TT() {
		t = new T();
	}
	
	public void getI() {
//		System.out.println(t.i);
	}
	
	public void getJ() {
//		System.out.println(t.j);
	}
	
	public void getK() {
//		System.out.println(t.k);
	}
	
	public void getM() {
		//only can access public field
		System.out.println(t.m);
	}
}

/**
 * can not access private and default field
 * @author Michael Zhang
 *
 */
class TTT extends T {
	
	public void getI() {
//		System.out.println(i);
	}
	
	public void getJ() {
		
//		System.out.println(j);
	}
	
	public void getK() {
		System.out.println(k);
	}
	
	public void getM() {
		//only can access public field
		System.out.println(m);
	}
	
}